<template>
  <div
    role="tooltip"
    aria-hidden="false"
    class="van_popover van_popper popover_game"
    tabindex="0"
    style="transform-origin: center top; z-index: 2003; position: absolute"
    x-placement="bottom-start"
  >
    <div class="box clearfix">
      <div class="left">
        <div class="banner">
          <a target="_blank" href="https://game.bilibili.com/fgo/cbc2022">
            <img
              src="/static/banner/game/01.jpg"
              alt="命运-冠位指定(Fate/GO)"
            />
            <span>命运-冠位指定(Fate/GO)</span>
          </a>
        </div>
        <div class="brief clearfix">
          <a
            target="_blank"
            :title="item.label"
            :href="item.href"
            v-for="item in briefList"
          >
            <img :src="item.imgUrl" :alt="item.label" />
            <span>{{ item.label }}</span>
          </a>
        </div>
      </div>
      <div class="right">
        <div class="all">
          <a
            target="_blank"
            :data-img="item.imgUrl"
            :href="item.href"
            style="overflow: hidden; white-space: nowrap"
            v-for="item in rankingList"
            @mouseenter="showPic(item.imgUrl)"
            @mouseleave="hiddenPic"
          >
            <span>{{ item.label }}</span>
          </a>
        </div>
      </div>
      <div class="imgdiv" :style="{ backgroundImage: `url(${img})` }"></div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      briefList: [
        {
          imgUrl: "/static/brief/game/01.png",
          href: "//game.bilibili.com/blhx/",
          label: "碧蓝航线",
        },
        {
          imgUrl: "/static/brief/game/02.png",
          href: "//game.bilibili.com/gt/carnival/h5",
          label: "坎特伯雷公主与骑士唤醒冠军之剑的奇幻冒险",
        },
        {
          imgUrl: "/static/brief/game/03.jpg",
          href: "//game.bilibili.com/blmn/",
          label: "爆裂魔女",
        },
      ],
      rankingList: [
        {
          imgUrl: "/static/ranking/game/01.png",
          herf: "//www.biligame.com/detail/?id=105040",
          label: "不良人3",
        },
        {
          imgUrl: "/static/ranking/game/02.png",
          herf: "//game.bilibili.com/xsddpd/",
          label: "小手电大派对",
        },
        {
          imgUrl: "/static/ranking/game/03.png",
          herf: "//skzy.biligame.com/skyy/",
          label: "深空之眼",
        },
        {
          imgUrl: "/static/ranking/game/04.png",
          herf: "//www.biligame.com/detail/?id=107684",
          label: "Project Snow",
        },
        {
          imgUrl: "/static/ranking/game/05.png",
          herf: "//www.biligame.com/detail/?id=104347",
          label: "英雄联盟电竞经理",
        },
        {
          imgUrl: "/static/ranking/game/06.png",
          herf: "//www.biligame.com/detail/?id=107111",
          label: "无期迷途",
        },
        {
          imgUrl: "/static/ranking/game/07.png",
          herf: "//game.bilibili.com/ylxe/",
          label: "代号:依露希尔",
        },
      ],
      img: "",
    };
  },
  methods: {
    showPic(url) {
      this.img = url;
    },
    hiddenPic() {
      this.img = "";
    },
  },
};
</script>

<style lang="scss">
.van_popover.van_popper.popover_game {
  padding: 0;
  top: 45px !important;
  left: -42px;
  box-shadow: none;
  background-color: transparent;
  border: none;
}
.clearfix {
  &::before,
  &::after {
    content: "";
    clear: both;
    display: table;
  }
}
.popover_game {
  padding: 0;
  width: 680px;
  height: 260px;
}
.box {
  background-color: #fff;
  width: 422px;
  height: 235px;
  position: relative;
  box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.4);
  border-radius: 0 0 4px 4px;
}
.left {
  float: left;
  margin-top: 10px;
  width: 240px;
  .banner {
    width: 217px;
    height: 116px;
    margin-left: 10px;
    a {
      width: 100%;
      height: 100%;
      display: block;
      position: relative;
      img {
        width: 100%;
        height: 100%;
        border-radius: 3px;
      }
      span {
        width: 200px;
        padding: 0 9px;
        border: 3px;
        position: absolute;
        bottom: 0;
        left: 0;
        font-size: 12px;
        line-height: 27px;
        color: #fff;
        text-shadow: 1px 1px 1px #000;
      }
      &:hover {
        text-decoration: none;
      }
    }
  }
  .brief {
    margin-top: 5px;
    padding: 0 5px;
    a {
      width: 76px;
      height: 98px;
      padding-top: 5px;
      display: block;
      float: left;
      overflow: hidden;
      text-align: center;
      img {
        width: 58px;
        height: 58px;
        border-radius: 10px;
        font-variant: JIS04;
      }
      &:hover {
        text-decoration: none;
        background-color: #e5e9ef;
      }
    }
    span {
      width: 65px;
      height: 36px;
      margin: auto;
      font-size: 12px;
      text-align: center;
      color: #222;
      overflow: hidden;
      text-overflow: ellipsis;
      word-break: break-all;
      white-space: normal;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }
  }
}
.right {
  margin-top: 10px;
  float: left;
  min-height: 212px;
  width: 182px;
  background-image: url("/static/bg/line.png");
  background-repeat: no-repeat;
  .all {
    padding: 32px 0 0 5px;
    background-image: url("/static/bg/title.png");
    background-repeat: no-repeat;
    a {
      padding-left: 14px;
      display: block;
      font-size: 12px;
      line-height: 25px;
      color: #222;
      overflow: hidden;
      white-space: normal;
      cursor: pointer;
      span {
        width: 13em;
        height: 25px;
        display: block;
        line-height: 25px;
        overflow: hidden;
      }
      &:hover {
        color: #00a1d6;
        background-color: #e5e9ef;
        text-decoration: none;
      }
    }
  }
}
.imgdiv {
  width: 200px;
  height: 200px;
  display: block;
  position: absolute;
  left: 400px;
  bottom: 0;
  background-size: cover;
  background-repeat: no-repeat;
}
</style>